<template>
  <el-card class="publish-container">
    <div slot="header" class="clearfix">
      <div class="head">修改内容</div>
    </div>
    <el-form label-width="80px"
    ref="myForm"
    :model="form">
      <el-form-item label="账号" prop="username">
        <el-input v-model="form.username"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input v-model="form.password"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="Ypush">修改</el-button>
      </el-form-item>
    </el-form>
  </el-card>
</template>
<script>
// 导入组件
export default {
  name: 'AddArticle',
  props: ['id'],
  data () {
    return {
      Info: {},
      form: {
        username: '201810137405',
        password: '123123'
      }
    }
  },
  methods: {
    async Ypush () {
      const id = this.Info.id
      try {
        this.$http.patch('http://localhost:3000/assets/' + id, this.form).then((res) => {
          console.log(res)
        })
      } catch (err) {
        console.log(err)
        this.$message.error('发布失败')
      }
    }
  },
  mounted () {
    this.Info = this.$route.query.Info
    this.Info = JSON.parse(localStorage.getItem('Info'))
  }
}
</script>
<style lang="less" scoped>
// 在父组件中去设置子组件的样式，加上/deep/ 实现穿透功能
.publish-container /deep/ .ql-container{
  height: 300px;
}
.publish-container /deep/ .ql-toolbar.ql-snow{
  padding: 0 8px;
}
  .head{
          width: 100%;
      height: 30px;
      line-height: 30px;
  }

</style>
